﻿using Microsoft.Xna.Framework.Graphics;

namespace SoulDoorEngine.Framework.Utilities
{
    public static class GraphicsUtil
    {
        //通过指定的参数创建二维渲染目标
        public static RenderTarget2D CreateRenderTarget()
        {
            return CreateRenderTarget(Engine.GraphicsDevice.Viewport.Width,
                Engine.GraphicsDevice.Viewport.Height);
        }

        //通过指定的参数创建二维渲染目标
        public static RenderTarget2D CreateRenderTarget(int Width, int Height)
        {
            return CreateRenderTarget(Width, Height,
                Engine.GraphicsDevice.DisplayMode.Format);
        }

        //通过指定的参数创建二维渲染目标
        public static RenderTarget2D CreateRenderTarget(int Width, int Height,
            SurfaceFormat Format)
        {
            return CreateRenderTarget(Width, Height, Format,
                Engine.GraphicsDevice.PresentationParameters.MultiSampleCount,
                Engine.GraphicsDevice.PresentationParameters.DepthStencilFormat);
        }

        //通过指定的参数创建二维渲染目标
        public static RenderTarget2D CreateRenderTarget(int Width, int Height,
            SurfaceFormat Format, int MultiSampleQuality,
            DepthFormat DepthFormat)
        {
            return new RenderTarget2D(Engine.GraphicsDevice, Width, Height, true, Format, DepthFormat, MultiSampleQuality, RenderTargetUsage.DiscardContents);
        }
    }
}
